<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<chiptrack:checkLogon sourcePage="/qadReportsAction.do?action=performance" />

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<HTML>
    <HEAD>
        <TITLE>Scalarsoft - ChipTrac</TITLE>
        <META http-equiv=Content-Type content="text/html; charset=windows-1252">
        <LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
        <SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></SCRIPT>
        <SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></SCRIPT>
        <SCRIPT>
            var dateElement = "";
            function openCalendar(dateValue)
            {
                dateElement = dateValue;
                newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
                newWindow.moveTo(550,180);
                newWindow.focus();
            }
            function assignDate(passedValue)
            {
                dateElement.value=passedValue;
                window.focus();
            }
            function loadDetails( changed )
            {
                var form = document.qadReportsForm;
                form.action = "<%=chipTracContext%>/qadReportsAction.do?action=performance";
                form.submit();
            }
            function validateFromAndToDates()
            {
                var form = document.qadReportsForm;
                errMsg = '';
                var errors = '';
                var pa	= document.getElementById("errors")
                var infoMessages = document.getElementById("infoMessagesId")
                var errorMessages = document.getElementById("errorMessagesId")
                infoMessages.innerHTML = '';
                errorMessages.innerHTML = '';
                if(chkDate(form.dueStartDate.value,'Start Date','N') == false)
                {
                    errors = errors + errMsg;
                    form.dueStartDate.focus();
                }
                if(chkDate(form.dueEndDate.value,'End Date','N') == false)
                {
                    errors = errors + errMsg;
                    form.dueEndDate.focus();
                }

                if(form.dueStartDate.value!='' && form.dueEndDate.value!='' && errors == '')
                {
                    if (!validateDateOut(formatDateAsMMDDYYYY(form.dueStartDate.value),formatDateAsMMDDYYYY(form.dueEndDate.value)))
                    {
                        errors = errors + "<li>End Date cannot be less than Start Date</li>";
                        form.dueEndDate.focus();
                    }
                }
                if ( errors != '' )
                {
                    pa.innerHTML = errors;
                    return false;
                }
                return true;
            }
            function submitPage()
            {
                var form = document.qadReportsForm;

                if ( validateFromAndToDates() )
                {
                    var d = new Date();
                    var day = d.getDate();
                    var month = d.getMonth()+1;
                    var year = d.getFullYear();
                    var hour = d.getHours();
                    var min = d.getMinutes();
                    var sec = d.getSeconds();

                    var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
                    form.prompt0.value  = form.processTypeName.value;
                    form.prompt1.value  = form.baseProductId.value;
                    form.prompt2.value  = form.processStepId.value;
                    form.prompt3.value  = 0;
                    var fromDate        = form.dueStartDate.value.trim();
                    var toDate          = form.dueEndDate.value.trim();
                    if ( fromDate.length > 0 )
                    {
                        form.prompt7.value  = fromDate;
                    }
                    else
                    {
                        form.prompt7.value  = 0;
                    }
                    if ( toDate.length > 0 )
                    {
                        form.prompt8.value  = toDate;
                    }
                    else
                    {
                        form.prompt8.value  = 0;
                    }

                    form.prompt0.value = form.processTypeName.value;
                    form.prompt1.value = form.baseProductId.value;
                    form.prompt2.value = form.processStepId.value;
                    form.prompt3.value = form.cardType.value;
                    form.prompt4.value = form.packageType.value;
                    form.prompt5.value = form.memorySize.value;
                    var selectPeriod;
                    var reportType;
                    for ( counter = 0; counter < form.datePeriod.length; counter++ )
                    {
                        if ( form.datePeriod[counter].checked )
                        {
                            selectPeriod = form.datePeriod[counter].value;
                            form.prompt6.value = form.datePeriod[counter].value;

                        }
                    }
                    form.prompt10.value = defaultPrompt;

                    for ( counter = 0; counter < form.reportType.length; counter++ )
                    {
                        if ( form.reportType[counter].checked )
                        {
                            reportType = form.reportType[counter].value;
                        }
                    }
                    if( reportType == "VendorCommitDate" )
                    {
                        form.prompt9.value = "close";
                        form.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/QAD/Actual_Completion_Vs_Vendor_Commit_Dates.rpt";
                    }
                    else if( reportType == "RequiredDueDate" )
                    {
                        form.prompt9.value = "close";
                        form.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/QAD/Actual_Completion_Vs_QAD_Required_Due_Date.rpt";
                    }
                    else if( reportType == "ActualQADReleaseDate" )
                    {
                        form.prompt9.value = "running";
                        form.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/QAD/Scheduled_Vs_Actual_Relesased_Dates.rpt";
                    }
                    else if( reportType == "StandardCycleTime" )
                    {
                        form.prompt9.value = "running";
                        form.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/QAD/Actual_vs_Standard_Cycle_Time.rpt";
                    }
                    else if( reportType == "OpenWorkOrders" )
                    {
                        form.prompt9.value = "running";
                        form.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/QAD/Work_Orders_Status_Report.rpt";
                    }
                    else if( reportType == "ClosedWorkOrders" )
                    {
                        form.prompt9.value = "close";
                        form.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/QAD/Work_Orders_Status_Report.rpt";
                    }
                    form.submit();
                }
            }
        </SCRIPT>
    </HEAD>
    <BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

    <!-- Top Header Start-->
    <%@ include file="/jsp/includes/header.jsp" %>
    <!-- Top Header End-->

    <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
      <TBODY>
      <TR>
        <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

        <!-- Side Navigation start -->
        <%@ include file="/jsp/operations/qad_reports_side_menu.jsp" %>
        <!-- end of the side navigations -->
    <TD bgcolor="#ffffff">
    <IMG height=9 src="images/spacer.gif" width=8></TD>
    <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
    <TD valign="top" width="100%">

    <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
    <BR>
    <!-- from here your body starts -->
    <center><span class="NArialW">Performance Reports</span></center>
    <!--<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5>-->
    <html:form action="/qadReportsAction" name="qadReportsForm" type="com.scalar.chiptrack.operations.forms.QADReportsForm">
        <input type="hidden" name="prompt0">
        <input type="hidden" name="prompt1">
        <input type="hidden" name="prompt2">
        <input type="hidden" name="prompt3">
        <input type="hidden" name="prompt4">
        <input type="hidden" name="prompt5">
        <input type="hidden" name="prompt6">
        <input type="hidden" name="prompt7">
        <input type="hidden" name="prompt8">
        <input type="hidden" name="prompt9">
        <input type="hidden" name="prompt10">
        <TABLE BORDER="0" WIDTH="90%" ALIGN=RIGHT>

            <TR>
                <TD colspan = "5"><FONT id="errors" class="NArialL" style="color:red"></FONT></TD>
            <TR>
            <TR><TD colspan='5' id='errorMessagesId'><chiptrack:errors styleClass='NArialL' /></TD></TR>
            <TR><TD colspan='5' id='infoMessagesId'><chiptrack:info styleClass='NArialL' /> </TD></TR>
            <TR><TD colspan='5'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></TD></TR>
            <TR>
                <TD WIDTH="15%" CLASS="NARIALL">Process Type</TD>
                <TD WIDTH="20%" CLASS="NARIALL">
                    <nested:select property="processTypeName" styleClass="txfield" onchange="javascript:loadDetails('processType')">
                        <html:option value="0">All Process Types</html:option>
                        <nested:options collection="processTypeNameList" property="value" labelProperty="label"/>
                    </nested:select>
                </TD>
                <TD WIDTH="10%">&nbsp;</TD>
                <TD WIDTH="13%" CLASS="NARIALL" nowrap>Base Product<br>Name</TD>
                <TD WIDTH="20%" CLASS="NARIALL">
                    <nested:select property="baseProductId" styleClass="txfield" onchange="javascript:loadDetails('baseProduct')">
                        <html:option value="0">All Base Products</html:option>
                        <nested:options collection="baseProductList" property="value" labelProperty="label"/>
                    </nested:select>
                </TD>
                <TD WIDTH="10%">&nbsp;</TD>
            </TR>
            <TR><TD colspan='5'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></TD></TR>
            <TR>
                <TD WIDTH="15%" CLASS="NARIALL">Part Number</TD>
                <TD WIDTH="20%" CLASS="NARIALL">
                    <nested:select property="processStepId" styleClass="txfield">
                        <html:option value="0">All Part Numbers</html:option>
                        <nested:options collection="partNumberList" property="processStepId" labelProperty="partNumber"/>
                    </nested:select>
                </TD>

                <TD WIDTH="10%">&nbsp;</TD>

               <TD WIDTH="13%" CLASS="NARIALL" nowrap>Card Type</TD>
                <TD WIDTH="20%" CLASS="NARIALL">
                     <select size="1" name="cardType" class="txfield" >
                        <option value="0">All Card Types</option>
                        <logic:iterate id="cardTypeList" name="cardTypeList">
                            <logic:notEqual name="cardTypeList" value="null">
                                <option value = "<bean:write name="cardTypeList" property="value"/>">
                                    <bean:write name="cardTypeList" property="label"/>
                                </option>
                            </logic:notEqual>
                        </logic:iterate>
                    </select>
                </TD>

                <TD WIDTH="10%">&nbsp;</TD>

            </TR>
             <TR><TD colspan='5'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></TD></TR>
             <TR>
                <TD WIDTH="15%" CLASS="NARIALL">Package Type</TD>
                <TD WIDTH="20%" CLASS="NARIALL">
                    <select size="1" name="packageType" class="txfield" >
                        <option value="0">All Package Types</option>
                        <logic:iterate id="packageTypeList" name="packageTypeList">
                            <logic:notEqual name="packageTypeList" value="null">
                                <option value = "<bean:write name="packageTypeList" property="value"/>">
                                    <bean:write name="packageTypeList" property="label"/>
                                </option>
                            </logic:notEqual>
                        </logic:iterate>
                    </select>
                </TD>
                <TD WIDTH="10%">&nbsp;</TD>
                <TD WIDTH="13%" CLASS="NARIALL" nowrap>Memory Size(MB)</TD>
                <TD WIDTH="20%" CLASS="NARIALL">
                   <select size="1" name="memorySize" class="txfield" >
                        <option value="0">All Memory Sizes</option>
                        <logic:iterate id="teraByteList" name="teraByteList">
                            <logic:notEqual name="teraByteList" value="null">
                                <option value = "<bean:write name="teraByteList" property="value"/>">
                                    <bean:write name="teraByteList" property="label"/>
                                </option>
                            </logic:notEqual>
                        </logic:iterate>
                    </select>
                </TD>

                <TD WIDTH="10%">&nbsp;</TD>

            </TR>
            <tr><td colsapn=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
            <tr>
                <td colspan=5>
                    <input type="radio" name="datePeriod" value="byRelDate"  checked>
                    <font class="NArialL">By Release Date</font>&nbsp;&nbsp;
                    <input type="radio" name="datePeriod" value="byDueDate">
                    <font class="NArialL">By Due Date</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </tr>
            <TR><TD colspan='5'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></TD></TR>
            <TR>
                <TD WIDTH="15%" CLASS="NARIALL">Start Date</TD>
                <TD WIDTH="20%" CLASS="NARIALL">
                    <nested:text property="dueStartDate" size="10" styleClass="txfield"/>&nbsp
		            <A href="javascript:openCalendar(document.qadReportsForm.dueStartDate)">
		            <IMG src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20 border="0" onmouseover="window.status='Click to Select Date';return true" onmouseout="window.status='';return true"></A>
                </TD>

                <TD WIDTH="10%">&nbsp;</TD>

                <TD WIDTH="13%" CLASS="NARIALL">End Date</TD>
                <TD WIDTH="20%" CLASS="NARIALL">
                    <nested:text property="dueEndDate" size="10" styleClass="txfield"/>&nbsp
		            <A href="javascript:openCalendar(document.qadReportsForm.dueEndDate)">
		            <IMG src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20 border="0" onmouseover="window.status='Click to Select Date';return true" onmouseout="window.status='';return true"></A>
                </TD>

                <TD WIDTH="10%">&nbsp;</TD>
            </TR>
            <TR><TD colspan='5'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></TD></TR>
            <tr>
                <td colspan=5>
                    <input type="radio" name="reportType" value="VendorCommitDate"  checked>
                    <font class="NArialL">Actual Complete Date vs. Vendor Commit Date</font>&nbsp;&nbsp;<br>
                    <input type="radio" name="reportType" value="RequiredDueDate">
                    <font class="NArialL">Actual Complete Date vs. QAD Required Due Date</font>&nbsp;&nbsp;<br>
                    <input type="radio" name="reportType" value="ActualQADReleaseDate">
                    <font class="NArialL">Schedule QAD Release Date vs. Actual QAD Release Date</font>&nbsp;&nbsp;<br>
                    <input type="radio" name="reportType" value="StandardCycleTime">
                    <font class="NArialL">Actual Process Time vs. Standard Cycle Time</font>&nbsp;&nbsp;<br>
                    <input type="radio" name="reportType" value="OpenWorkOrders">
                    <font class="NArialL">Open Work Orders</font>&nbsp;&nbsp;<br>
                    <input type="radio" name="reportType" value="ClosedWorkOrders">
                    <font class="NArialL">Closed Work Orders</font>&nbsp;&nbsp;<br>
                </td>
            </tr>
            <TR>
                <TD>&nbsp;</TD>
            </TR>
            <TR>
                <TD COLSPAN=5 align="center">
                    <A href="javascript:submitPage();" onMouseOver="window.status='Click to Generate A Report';return true" onMouseOut="window.status='';return true" title= "Click here to Generate A Report "><img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17"></A>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="javascript:document.qadReportsForm.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true"title="Click here to Reset"></a>
                </TD>
            </TR>
        </TABLE>
    </html:form>
    <!-- till here -->
    <BR><BR><BR></TD>
    <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
    </TABLE>
    <!-- Footer starts here -->
    <%@ include file="/jsp/includes/footer.jsp" %>
    <!-- footer end here -->
    </BODY>
</HTML>
